package huriezy.quickcontacts.models.interfaces;

import java.security.Provider;

import android.location.Address;
import android.location.Geocoder;
import android.location.Location;

public interface ILocationManager {

	/**
	 * Configure all needed connections before starting location process.
	 */
	public void initLocationConnections();

	/**
	 * @return true if the current provider is activated, false otherwise.
	 */
	public boolean isProviderAvailable();

	/**
	 * Start requests to update the current {@link Location}. If the needed
	 * {@link Provider} is disabled (GPS), this method is disabled.
	 */
	public void startLocationUpdates();

	/**
	 * Stop requests for {@link Location} updates.
	 */
	public void stopLocationUpdates();

	/**
	 * @return the last {@link Location} the system has registered.
	 */
	public Location getLastKnownLocation();

	/**
	 * Set the {@link IAddressDetectionListener}. This listener is notified of
	 * every {@link Location} updated.
	 * 
	 * @param listener
	 */
	public void setAddressDetectionListener(IAddressDetectionListener listener);

	/**
	 * Search for the {@link Address} corrsponding to the donate
	 * {@link Location} using a {@link Geocoder} object.
	 * 
	 * @param lastKnownLocation
	 * @return
	 */
	public Address getAddressFromLocation(Location lastKnownLocation);

}
